package com.yangguang.huahui.mvp.presenter;

import com.yangguang.huahui.R;
import com.yangguang.huahui.entity.Reply;
import com.yangguang.huahui.mvp.model.ProblemModel;
import com.yangguang.huahui.mvp.view.ReplyListView;
import com.yangguang.huahui.rx.RxManager;
import com.yangguang.huahui.rx.RxSubscriber;

/**
 * Created by Administrator on 2017/3/29.
 */

public class ReplyListPresenter extends BasePresenter<ReplyListView>{
    ProblemModel model;

    public ReplyListPresenter() {
        model = new ProblemModel();
    }
    public void getList(){
        mSubscription = RxManager.getInstance().doSubscribe(model.getReplyList(), new RxSubscriber<Reply>(false) {
            @Override
            protected void _onNext(Reply reply) {
                mView.onSuccess(reply);
            }

            @Override
            protected void _onError() {
                mView.onError();
            }
        });
    }

    public void getQuestionList(String uid){
        mSubscription = RxManager.getInstance().doSubscribe(model.getQuestionList(uid), new RxSubscriber<Reply>(false) {
            @Override
            protected void _onNext(Reply reply) {
                mView.onSuccess(reply);
            }

            @Override
            protected void _onError() {
                mView.onError();
            }
        });
    }
}
